package com.funcourse.demo.api.restful.io.response.error;

public enum CommonUsedError implements BusinessError {
  SUCCESS(200,""),BAD_REQUEST(400,"bad request"),UNAUTHORIZED(403,"UNAUTHORIZED"),NOT_FOUND(404,"NOT_FOUND"),SERVER_ERROR(500,"server error");
  private Integer errorCode;
  private String errorMsg;
  CommonUsedError(Integer errorCode,String errorMsg){
    this.errorCode =  errorCode;
    this.errorMsg = errorMsg;
  }
  public CustomizedError customizedError(String desc){
    return new CustomizedError(this.errorCode,desc);
  }
  @Override
  public Integer getErrorCode() {
    return this.errorCode;
  }

  @Override
  public String getErrorMessage() {
    return this.errorMsg;
  }
}
